cmake_minimum_required(VERSION 3.27)

set(CMAKE_C_COMPILER "/home/he/Tina5.0-V1.1/prebuilt/rootfsbuilt/arm/toolchain-sunxi-glibc-gcc-830/toolchain/bin/arm-openwrt-linux-gcc")

project(tplayer_kbd C)

set(CMAKE_C_STANDARD 11)

#SET(CMAKE_C_COMPILER_WORKS TRUE)
#SET(CMAKE_CXX_COMPILER_WORKS TRUE)

set(CMAKE_C_FLAGS_DEBUG "-O3 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3")

include_directories(
        .
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/usr/include"
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/usr/include/allwinner"
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/usr/include/allwinner/include/"
)

link_directories(
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/root-t113-pi/lib"
        "/home/he/Tina5.0-V1.1/out/t113/pi/openwrt/staging_dir/target/usr/lib"
)

file(GLOB_RECURSE SOURCES "main.c")

add_compile_options(-pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard -fstack-protector)
#add_compile_options(-fsanitize=address -fno-omit-frame-pointer)

add_executable(tplayer_kbd ${SOURCES})
target_link_libraries(tplayer_kbd PRIVATE tplayer cdx_base ncurses stdc++)